﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>编辑会员资料</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="/style/admin/style/adminStyle.css" rel="stylesheet" type="text/css" />
        <script src="/style/admin/js/jquery-2.1.4.min.js"></script>
    </head>
    <body>
        <div class="wrap">
            <div class="page-title">
                <span class="modular fl"><i class="edit_user"></i><em>编辑会员资料</em></span>
            </div>

            <form id="EditForm" onsubmit="return false">
                <table class="list-style">
                    <tr>
                        <td style="width:15%;text-align:right;">会员昵称：</td>
                        <td><input type="text" name="name" class="textBox length-middle" value="{{$data->name}}"/></td>
                        <input type="hidden" name="id" class="textBox length-middle" value="{{$data->id}}"/>
                    </tr>
                    <tr>
                        <td style="text-align:right;">电子邮件：</td>
                        <td><input type="text" name="email" class="textBox length-middle" value="{{$data->email}}"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">手机号码：</td>
                        <td><input type="text" name="tel" class="textBox length-middle" value="{{$data->tel}}"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">可用资金：</td>
                        <td>
                            <input type="text" name="money" class="textBox length-short" value="{{$data->money}}" disabled="disabled"/>
                            <span>元</span>
                        </td>
                    </tr> 
                    <tr>
                        <td style="text-align:right;">会员等级：</td>
                        <td>
                            <select class="textBox" name="rank">
                                <option value="0" <?php
                                if ($data->rank == 0) {
                                    echo "selected";
                                }
                                ?>>请选择会员等级</option> 
                                <option value="3" <?php
                                if ($data->rank == 3) {
                                    echo "selected";
                                }
                                ?>>白金会员</option>
                                <option value="2" <?php
                                        if ($data->rank == 2) {
                                            echo "selected";
                                        }
                                        ?>>黄金会员</option>
                                <option value="1" <?php
                                        if ($data->rank == 1) {
                                            echo "selected";
                                        }
                                        ?>>普通会员</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">重置密码：</td>
                        <td><input type="password" name="pass" class="textBox length-middle" value="{{$data->pass}}"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">确认密码：</td>
                        <td><input type="password" name="repass" class="textBox length-middle" value="{{$data->pass}}"/></td>
                    </tr>
                    <tr>
                        <td style="text-align:right;"></td>
                        <td><input type="submit" onclick="EditUser({{$data->id}});" class="tdBtn" value="更新保存"/></td>
                    </tr>
                </table>
            </form>
        </div>
        <script>
              function EditUser(id){
                   str=$("#EditForm").serialize();
                   $.post(
                         '/admin/users/'+id,
                         {str:str,'_token':"{{csrf_token()}}","_method":"put"},
                         function(data){
                             if(data==1){
                                 window.location.href="/admin/users";
                             }
                         }
                )
              }
        </script>
    </body>
</html>